this.BX=this.BX||{};(function(e,i){"use strict";var t=function(){function e(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{filterId:"",useQuickSearch:false,quickSearchField:{name:"",field:""}};babelHelpers.classCallCheck(this,e);this.filterId=i.filterId;this.useQuickSearch=i.useQuickSearch;this.quickSearchField=i.quickSearchField;this.filter=null;this.currentPreset=[];this.currentFields=[];this.sourceFilter=[]}babelHelpers.createClass(e,[{key:"getFilterId",value:function e(){return this.filterId}},{key:"getFilter",value:function e(){this.sourceFilter=[];this.initFilter();if(!i.Type.isNil(this.filter)){this.parseFilterRows();this.parseQuickSearchValue()}return this.sourceFilter}},{key:"parseFilterRows",value:function e(){var t=this;var r=this.filter.getSearch().prepareSquaresData(this.currentFields);this.sourceFilter=r.map(function(e){var r=t.currentFields.find(function(i){return i.NAME===e.value&&!t.filter.getPreset().isEmptyField(i)});var s={name:e.name,key:r.NAME,value:i.Runtime.clone(r.VALUE||r.VALUES)};if(i.Type.isString(s.value)){s.value={VALUE:s.value}}if(i.Type.isPlainObject(r.SUB_TYPE)){s.value.SUB_TYPE=r.SUB_TYPE.VALUE}return s})}},{key:"parseQuickSearchValue",value:function e(){var i=this;if(this.useQuickSearch){var t=this.filter.getSearch().getSearchString();if(t!==""){var r={VALUE:t,QUICK_SEARCH:"Y"};var s="".concat(this.quickSearchField.name,": ").concat(t);var l=false;if(this.sourceFilter.length>0){var a=this.sourceFilter.findIndex(function(e){var t=e.key;return t===i.quickSearchField.field});if(a>-1){l=true;this.sourceFilter[a].name=s;this.sourceFilter[a].value=r}}if(!l){this.sourceFilter.push({name:s,key:this.quickSearchField.field,value:r})}}}}},{key:"initFilter",value:function e(){if(this.filter===null){this.filter=BX.Main.filterManager.getById(this.getFilterId())}if(!i.Type.isNil(this.filter)){this.currentPreset=this.filter.getPreset().getCurrentPresetData();this.currentFields=[].concat(babelHelpers.toConsumableArray(this.currentPreset.FIELDS),babelHelpers.toConsumableArray(this.currentPreset.ADDITIONAL))}}}]);return e}();e.UiFilterConverter=t})(this.BX.Landing=this.BX.Landing||{},BX);
//# sourceMappingURL=uifilterconverter.bundle.map.js